class mssqlcluster {


  file { 'create_sw':
    ensure  => directory,
    path    => 'D:\software',
  }

  file { 'create_swstore':
    ensure  => directory,
    path    => 'D:\software\source',
    require => File ['create_sw'],
  }

  pget { 'download_sqliso':
    source      => 'https://s3.amazonaws.com/rely-software/mssql/SQLServer2012SP1-FullSlipstream-ENU-x64.iso',
    target      => 'D:\software\source',
    require     => File ['create_swstore'],
  }

  file { 'create_sqldir':
    ensure  => directory,
    path    => 'D:\software\sql',
    require => File ['create_sw'],
  }


#  exec { 'uninstall_badupdate_KB2966828':
#    command   => "DISM.exe /Online /Remove-Package /PackageName:Package_for_KB2870699~31bf3856ad364e35~amd64~~6.2.1.1 /quiet /norestart",
#    cwd       => $media,
#    path      => $media,
#    logoutput => true,
#    creates   => $instancedir,
#    timeout   => 1200,
#    require   => [ File['C:\sql2008install.ini'], Dism['NetFx3'] ],
#  }

  class {'windows_sql':
    features            => 'SQLENGINE,CONN,SSMS,ADV_SSMS',
    forcerestart        => false,
    configurationfile   => 'C:\configurationfile.ini',
#    pid                 => 'SYOUR-PRODU-CTKEY-OFSQL-2012S',
    sqlsysadminaccounts => 'SQLAdmin',
    agtsvcaccount       => 'svc_sqlagt',
    isopath             => 'D:\software\source\SQLServer2012SP1-FullSlipstream-ENU-x64.iso',
    sqlpath             => 'D:\software\sql',
    sqlsvcaccount       => 'svc_sqlsvc',
    securitymode        => 'sql',
    sapwd               => 'MySup3rGre@tp@ssw0rDO3nOT',
    mode                => 'master',
    require             => [ Pget ['download_sqliso'], Class ['mssqlcluster::admember'] ],
  }

}
